package com.jml.api.controller;

//import com.codingapi.tx.annotation.TxTransaction;
import com.jml.api.dao分布式事务.StockMapper;
import com.spring4all.swagger.EnableSwagger2Doc;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
//@EnableSwagger2Doc
@Api("生产者接口")
public class MemberController {

	@Value("${server.port}")
	private String port;

	@Autowired
	private StockMapper stockMapper;


	@RequestMapping("/getMember")
	public String getMember() {
		return "this is getMember"+port;
	}

	/*@TxTransaction
	@Transactional
	@RequestMapping("/txTransaction")
	public String txTransaction() {
		//减去库存
		int updateStockResult = stockMapper.updateStock(20L);
		return "this is getMember"+port;
	}*/

	@ApiOperation("获取会员相关的信息")
	@ApiImplicitParam(name = "userName",value = "用户信息",required = true,dataType = "String")
	@PostMapping("/getMemberSwagger")
	public String getMemberSwagger(String userName){
		return "username:"+userName;
	}

}


